package com.zhentao;

import com.baomidou.mybatisplus.annotation.DbType;
import com.zhentao.apis.schedule.ScheduleClientApi;
import com.zhentao.schedule.apis.article.ArticleClientApi;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;

import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.annotation.EnableScheduling;

/**
 * @Date 2024/2/24 8:45
 * @Author xdm
 **/
@SpringBootApplication
@EnableDiscoveryClient
@EnableScheduling
@EnableAsync  // 启用异步支持 // 如果有 MyBatis 映射器，添加此注解
@EnableFeignClients(clients={ArticleClientApi.class, ScheduleClientApi.class})
@MapperScan("com.zhentao.mapper")
public class WeMediaApplication {

    public static void main(String[] args) {
        SpringApplication.run(WeMediaApplication.class, args);
    }

    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}